import { _decorator, Node } from 'cc';
import BaseMain from 'db://xforge/base/BaseMain';
import { app } from 'db://xforge/XForge';
import { ModuleNames } from '../Settings';
const { ccclass, property } = _decorator;

@ccclass('Main')
export default class Main extends BaseMain {
    @property({
        type: Node,
        tooltip: '启动页'
    })
    public splashScreen: Node;

    protected start(): void {
        app.lib.task.createSync()
            .add((next) => {
                this.setup();
                next();
            })
            .add((next) => {
                app.loadGlobal(() => next());
            })
            .add((next) => {
                app.loadModule(ModuleNames.Home, () => next());
            })
            .start(() => {
                this.splashScreen.destroy();
            });
    }
}
